home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / ecstr2.arc / STRXCAT.C < prev    next >
C/C++ Source or Header  |  1987-03-04  |  1KB  |  41 lines

  1. /*  File   : strxcat.c
  2.     Author : Richard A. O'Keefe.
  3.     Updated: 25 may 1984
  4.     Defines: strxcat()
  5.  
  6.     strxcat(dst, src1, ..., srcn, NullS)
  7.     moves the concatenation of dst,src1,...,srcn to dst, terminates it
  8.     with a NUL character, and returns the original value of dst.
  9.     It is just like strcat except that it concatenates multiple sources.
  10.     Equivalence: strxcat(d, s1, ..., sn) <=> strxcpy(d, d, s1, ..., sn).
  11.     Beware: the last argument should be the null character pointer.
  12.     Take VERY great care not to omit it!  Also be careful to use NullS
  13.     and NOT to use 0, as on some machines 0 is not the same size as a
  14.     character pointer, or not the same bit pattern as NullS.
  15. */
  16.  
  17. #include "strings.h"
  18. #include <varargs.h>
  19.  
  20. /*VARARGS*/
  21. char *strxcat(va_alist)
  22.     va_dcl
  23.     {
  24.        va_list pvar;
  25.        register char *dst, *src;
  26.        char *bogus;
  27.  
  28.        va_start(pvar);
  29.        dst = va_arg(pvar, char *);
  30.        bogus = dst;
  31.        while (*dst) dst++;
  32.        src = va_arg(pvar, char *);
  33.        while (src != NullS) {
  34.            while (*dst++ = *src++) ;
  35.            dst--;
  36.          src = va_arg(pvar, char *);
  37.        }
  38.        return bogus;
  39.     }
  40.  
  41.